package com.xxx.store.controller;


import com.xxx.store.entity.Vote;
import com.xxx.store.entity.VoteItem;
import com.xxx.store.service.VoteItemService;
import com.xxx.store.service.VoteService;
import com.xxx.store.utils.Result;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Date;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2023-04-26
 */
@RestController
@RequestMapping("/voteItem")
public class VoteItemController extends BaseController <VoteItem, VoteItemService>{

    @Resource
    VoteItemService voteItemService;
    @PostMapping("add")
    public Result add(@RequestBody VoteItem voteItem) {
        Date date = new Date();
        voteItem.setCreateTime(date);
        voteItemService.save(voteItem);
        return Result.ok("添加成功", voteItem);
    }
}

